﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using AMatysiak.Methods;
using System;

namespace AMatysiakTest.Methods
{
    [TestClass]
    public class SubstrCountTest
    {
        [TestMethod]
        public void emptyString()
        {
            int count = "".SubstrCount("*");
            Assert.AreEqual(0, count);
        }

        [TestMethod]
        public void singleSubstr()
        {
            int count = "*".SubstrCount("*");
            Assert.AreEqual(1, count);
        }

        [TestMethod]
        public void substrBeyondOtherChars()
        {
            int count = "a*a".SubstrCount("*");
            Assert.AreEqual(1, count);
        }

        [TestMethod]
        public void nearToOtherMatch()
        {
            int count = "a**a".SubstrCount("*");
            Assert.AreEqual(2, count);
        }

        [TestMethod]
        public void beyondText()
        {
            int count = "a*bb*a".SubstrCount("*");
            Assert.AreEqual(2, count);
        }
    }
}
